{php include pubTemplate("header")}

<div class="container">

  <div class="row">

    <div class="col-md-3">
      <div class="my_left">

        {php include pubTemplate("my")}

      </div>
    </div>


    <div class="col-md-9">
      <div class="card">
        <div class="card-body">



          {template setting_menu}



          <div class="row">
            <div class="col-md-3"></div>
            <div class="col-md-6">


              {if $TS_SITE['regtype']=='0' || $TS_SITE['regtype']=='2'}
              <form role="form" method="POST" action="{tsUrl('my','setting',array('ts'=>'emaildo'))}">

                <div class="form-group">
                  <label>当前Email帐号：</label>
                  <div class="text-black-50">{$strUser['email']}</div>
                </div>

                <div class="form-group">
                  <label>新Email帐号：</label>
                  <input class="form-control" name="email" type="email" />
                </div>

                <input type="hidden" name="token" value="{$_SESSION['token']}" />
                <button class="btn btn-sm btn-info" type="submit">提交修改</button>

                <small class="text-black-50">(修改Email登录帐号将需要重新验证Email)</small>

              </form>
              {/if}

              {if $TS_SITE['regtype']=='2'}
              <hr />
              {/if}


              {if $TS_SITE['regtype']=='1' || $TS_SITE['regtype']=='2'}
              <form id="comm-form" role="form" method="POST" action="{SITE_URL}index.php?app=user&ac=phone&ts=editphone">

                <div class="form-group">
                  <label>当前手机号：</label>
                  <div class="text-black-50">{$strUser['phone']}</div>

                </div>

                <div class="form-group">
                  <label>新手机号：</label>
                  <input id="myphone" class="form-control" name="phone" type="number" />
                </div>

                <div class="form-group">
                  <label>图片验证码：</label>

                  <div class="d-flex flex-row">
                    <div class="d-flex"><input  id="authcode" type="text" name="authcode" class="form-control" value=""></div>
                    <div class="d-flex ml-1">

                      <img src="{SITE_URL}index.php?app=pubs&ac=code" onclick="javascript:newgdcode(this,this.src);" title="点击刷新验证码" alt="点击刷新验证码" style="cursor:pointer;" />

                    </div>
                  </div>

                </div>

                <div class="form-group">
                  <label>手机验证码：</label>

                  <div class="d-flex flex-row">
                    <div class="d-flex"><input type="text" class="form-control" name="phonecode" value=""></div>
                    <div class="d-flex ml-1"><button id="mybtn" type="button" class="btn btn-outline-secondary">获取验证码</button></div>
                  </div>

                </div>

                <input type="hidden" name="token" value="{$_SESSION['token']}" />
                <button class="btn btn-sm btn-info" type="submit">提交修改</button>



              </form>
              {/if}


            </div>
            <div class="col-md-3"></div>
          </div>


        </div>
      </div>
    </div>

  </div>

</div>


<!--{if $TS_SITE['is_vaptcha']}-->
<script src="https://v-cn.vaptcha.com/v3.js"></script>
<script>
vaptcha({
    vid: '{$TS_SITE[vaptcha_vid]}',// 验证单元id
    mode: 'invisible',// 显示类型 隐藏式
    scene: 0,// 场景值 默认0
    area: 'auto' //验证节点区域,默认 auto,可选值 auto,sea,na,cn
}).then(function (vaptchaObj) {

    obj = vaptchaObj; //将VAPTCHA验证实例保存到局部变量中

    vaptchaObj.listen("pass", function () {
        // 验证成功进行后续操作

        serverToken = vaptchaObj.getServerToken()

        sendPhoneCode(1,serverToken.token,serverToken.server)

        vaptchaObj.reset(); //重置验证码
        
    });

    //关闭验证弹窗时触发
    vaptchaObj.listen("close", function () {
        //验证弹窗关闭触发
    });

})

$("#mybtn").on("click", function () {
    var phone = $("#myphone").val();
    var authcode = $("#authcode").val();

    if(phone && authcode){
        //人机验证
        obj.validate();
    }else{
        tsNotice('手机号和图形验证码必须填写！');
    }
});
</script>
<!--{else}-->

<script>
$("#mybtn").on("click", function () {
    var phone = $("#myphone").val();
    var authcode = $("#authcode").val();

    if(phone && authcode){
        sendPhoneCode(1)
    }else{
        tsNotice('手机号和图形验证码必须填写！');
    }
});
</script>

<!--{/if}-->

{php include pubTemplate("footer")}